data<-read.table("probeset_survival.txt",sep="\t",head=T)s2<-sample(s1, size=length(s1), replace = FALSE, prob = NULL)
colnames(data)
 data$TOP3<-mean(data[,7],data[,9],data[,10])
 data$TOP3<-apply(data[,c(7,9,10)],1,mean)
data[1,]
mean(7.728246,6.876104,7.015816)
mean(c(7.728246,6.876104,7.015816))
colnames(data)
dim(data)
seq(1,1133,length.out=20)
seq(1,1133,1)
seq<-seq(1,1133,1)
sample.int(1133, size = 1133, replace = FALSE, prob = NULL)
d<-1
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<1134)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= 1133)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > 1133)
{
sequ<-seq(s+1,1133,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
num<-20
d<-1
length<-1133
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
num<-20
d<-1
length<-1133
#while(d<num+1)
#{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
sub
main
num<-20
d<-1
length<-1133
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
d<-d+1
}
dim(data)
data[1,]
colnames(data)
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
library(survival)
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
fit
pred <- predict(fit1, data,type="lp")
pred <- predict(fit, data,type="lp")
length(pred)
pred[1:5]
data<-data[with(data,order(RFSTIME)),]
dim(data)
data[1,]
data[1133,]
data[1103,]
data[903,]
num<-20
d<-1
length<-1133
hazardrank<-c()
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
pred <- predict(fit, data,type="lp")
wanted_ranks<-rank(pred)
hazardrank[i,sub]<-wanted_ranks[sub]
d<-d+1
}
data<-data[with(data,order(RFSTIME)),]
num<-20
d<-1
length<-1133
hazardrank<-c()
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
pred <- predict(fit, data,type="lp")
wanted_ranks<-rank(pred)
hazardrank[sub]<-wanted_ranks[sub]
d<-d+1
}
summary(hazardrank)
data$top3_hazardrank<-hazardrank
surv<-survConcordance(Surv(OS,ALIVEOS)~diff,data=clin2)
surv<-survConcordance(Surv(OS,ALIVEOS)~top3_hazardrank,data=data)
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
fit
surv<-survConcordance(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
surv
surv$concordance
surv$std.err
fit
effect<-as.numeric(s["top3_hazardrank","coef"])
s<-summary(fit)$coefficients
effect<-as.numeric(s["top3_hazardrank","coef"])
effect
num<-20
d<-1
length<-1133
hazardrank<-c()
coeff<-c()
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
s<-summary(fit)$coefficients
effect<-as.numeric(s["TOP3","coef"])
pred <- predict(fit, data,type="lp")
wanted_ranks<-rank(pred)
hazardrank[sub]<-wanted_ranks[sub]
coeff<-c(coeff,effect)
d<-d+1
}
length(coeff)
mean(coeff)
num<-20
d<-1
length<-1133
hazardrank<-c()
coeff<-c()
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
s<-summary(fit)$coefficients
effect<-as.numeric(s["TOP3","coef"])
pred <- predict(fit, data,type="lp")
wanted_ranks<-rank(pred)
hazardrank[sub]<-wanted_ranks[sub]
if(effect > 0)
{
effect <- 1
}
else
{
effect <- -1
}
coeff<-c(coeff,effect)
d<-d+1
}
data$top3_hazardrank<-hazardrank
surv<-survConcordance(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
surv$concordance
surv$std.err
mean(coeff)
coeff
num<-20
d<-1
length<-1133
hazardrank<-c()
coeff<-c()
eff<-c()
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ TOP3,data=data1)
s<-summary(fit)$coefficients
effect<-as.numeric(s["TOP3","coef"])
pred <- predict(fit, data,type="lp")
wanted_ranks<-rank(pred)
hazardrank[sub]<-wanted_ranks[sub]
eff<-c(eff,effect)
if(effect > 0)
{
effect <- 1
}
else
{
effect <- -1
}
coeff<-c(coeff,effect)
d<-d+1
}
data$top3_hazardrank<-hazardrank
surv<-survConcordance(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
surv$concordance
surv$std.err
mean(coeff)
eff
fit<-fit(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
fit<-coxph(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
fit
for(i=0;i<10;i++)

print(i)
}
sample.int(10, size=10, replace = FALSE, prob = NULL)
data[1,]
data<-read.table("probeset_survival.txt",sep="\t",head=T)
data<-data[with(data,order(RFSTIME)),]
num<-20
d<-1
length<-1133
hazardrank<-c()
coeff<-c()
eff<-c()
data$EXPR<-data$TOP3
#boot straping and permuting
while(d<num+1)
{
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ EXPR,data=data1)
s<-summary(fit)$coefficients
effect<-as.numeric(s["EXPR","coef"])
pred <- predict(fit, data,type="lp")
wanted_ranks<-rank(pred)
hazardrank[sub]<-wanted_ranks[sub]
eff<-c(eff,effect)
if(effect > 0)
{
effect <- 1
}
else
{
effect <- -1
}
coeff<-c(coeff,effect)
d<-d+1
}
data$top3_hazardrank<-hazardrank
surv<-survConcordance(Surv(RFSTIME,RFSEVENT) ~ top3_hazardrank,data=data)
#AUC
surv$concordance
#stderror
surv$std.err
#Mean Sign of EXPR coeff
mean(coeff)
data<-read.table("probeset_survival.txt",sep="\t",head=T)
data<-data[with(data,order(RFSTIME)),]
num<-20
d<-1
length<-1133
hazardrank<-c()
coeff<-c()
eff<-c()
data$EXPR<-data$TOP3
s<-d;
sub<-c()
main<-c()
if(d > 1)
{
main<-seq(1,d-1,1)
}
nu<-1
while(s<length+1)
{
sub[nu]<-s
sequ<-c()
if(s+1 <= length)
{
sequ<-seq(s+1,s+num-1,1)
if(s+num-1 > length)
{
sequ<-seq(s+1,length,1)
}
}
main<-c(main,sequ)
nu<-nu+1
s<-s+num
}
data1<-data[main,]
fit <- coxph(Surv(RFSTIME,RFSEVENT) ~ EXPR,data=data1)
data[1,]
savehistory("kk.R")
